﻿using BootstrapBlazor.Components;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; 

namespace CodeMan.Models
{
    /// <summary>
    /// 类属性
    /// </summary>
   
    public class ClassAttribute
    {
        
        [AutoGenerateColumn(Ignore = true)]
        public int ClassDTOId { get; set; }

        /// <summary>
        /// 序号
        /// </summary>
        [AutoGenerateColumn(Order = 1, Sortable = true)]
        public int SortNo { get; set; }
         
        /// <summary>
        /// 类名称
        /// </summary>
        [AutoGenerateColumn(Order = 0, Sortable = true, Readonly = true)]
        public string ClassName { get; set; }

        /// <summary>
        /// 字段名称
        /// </summary>
        [AutoGenerateColumn(Order = 2, Sortable = true)]
        public string Name { get; set; }
        /// <summary>
        /// 类型
        /// </summary>
        [AutoGenerateColumn(Order = 3, Sortable = true)]
        public AttrType Type { get; set; }
        /// <summary>
        /// 字段说明
        /// </summary>
        [AutoGenerateColumn(Order = 4, Sortable = true)]
        public string Desc { get; set; }
        /// <summary>
        /// 长度
        /// </summary>
        [AutoGenerateColumn(Order = 5, Sortable = true)]
        public int Length { get; set; }
        /// <summary>
        /// 默认值 
        /// </summary>
        [AutoGenerateColumn(Order = 6, Sortable = true)]
        public string defaultValue { get; set; }

        [AutoGenerateColumn(Ignore = true)] 
        public ClassDTO OneClassDTO { get; set; }

    }


    /// <summary>
    /// 字段类型
    /// </summary>
    public enum AttrType
    {
        [Display(Name = "字符")]
        sstring,
        [Display(Name = "整数")]
        iint,
        [Display(Name = "小数")]
        ffloat
    }
}
